# $Id$
# Contributor: Dennis "Gyroplast" Herbrich <dennis@archlinux.org>,  dorphell <dorphell@archlinux.org>
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>

pkgname=isdn4k-utils
pkgver=3.27
pkgrel=3
pkgdesc="User space administration programs and tools for ISDN"
arch=('i686' 'x86_64')
url="http://www.isdn4linux.de/"
license=('GPL')
makedepends=('git')
depends=('ncurses' 'sh') 
backup=(etc/isdn/{callerid.conf,isdn.conf,rate.conf,isdnlog.isdnctrl0.options})
options=('!makeflags')
source=(isdn4k-utils::git+git://git.misdn.eu/isdn4k-utils.git#tag=v${pkgver}
        config
        gnu89-inline.patch
        va_list.patch)
replaces=('capi4k-utils')
md5sums=('SKIP'
         'ea3c71054234f9ef6bcf9325e36c4a38'
         '165084a9096cc1ad043cc00a5cc05c0b'
         '81709ee10336a2df684a5398f42ef514')

prepare() {
  CPPFLAGS="$CPPFLAGS -O2"
  cd $srcdir/$pkgname
  patch -Np1 -i $srcdir/gnu89-inline.patch
  patch -Np1 -i $srcdir/va_list.patch
  cp $srcdir/config ./.config
  cd capiinfo
  aclocal
  automake --add-missing
  autoreconf
  cd $srcdir/$pkgname
  cd capifax
  aclocal 
  automake --add-missing
  autoreconf
  cd $srcdir/$pkgname
  make subconfig
}

build() {
  cd $srcdir/$pkgname
  PERL_USE_UNSAFE_INC=1 make
}

package() {
  cd $srcdir/$pkgname
  install -dm755 $pkgdir/usr/bin
  make DESTDIR=$pkgdir install
  chmod 755 $pkgdir/usr/bin/*
}
